[//

    async function( kuo,Context,context){
        let LANG = this.LANG();
        let $DATA = Object.assign({},this.$DATA);
        let $hash = 'safetoken/'+kuo.adminid;
        $DATA.token = Mode("Tools").Uuid();
        await  Mem.Set($hash,$DATA.token);
        let  $kongzhi = kuo.Path.length > 0?kuo.Path[kuo.Path.length-1]:"get";
        let  $db = await db('user');
        let  $_GET = kuo.get;
        let  $_POST = kuo.post;
        let  $chushi = true; 
       
        if($kongzhi == 'get'){
    
            let $page = Mode("Tools").Int($_GET['page']?$_GET['page']:1);
            let $limitx  =  Mode("Tools").Int($_GET['limit']?$_GET['limit']:10);
            if($limitx < 10 ){
                $limitx = 10;
            }else if($limitx > 100 ){
                $limitx = 100;
            }
            let $where ={};
            if(isset($_GET['uid']) && $_GET['uid'] !=""){
                $where['id']= $_GET['uid'];
            }
            let $data  = await $db.Where($where).Limit($limitx,$page).Order("id desc").Select();
            let $total = await $db.Where($where).Total();
            if(!$data){
                $data= [];
            }
            $DATA.code = 0;
            $DATA.count = $total;
            if($page == 1 && $chushi){
              
            }

            $DATA.data = $data;
    
    
        }else if($kongzhi == 'put'){
            let $id = Mode("Tools").Int($_POST['id']?$_POST['id']:0);
            let $data = await $db.Where({id: $id}).Find();
            if(!$data){
                $DATA.code = -1;
                $DATA.msg = LANG.admin_id_no;
                Context.body = JSON.stringify($DATA);
                return ;
            }

            let baoliu = {
                'id':'id',
                'recharge':'recharge',
                'money':'money',
                'integral':'integral',
                'currency':'currency',
                'regip':'regip',
                'regtime':'regtime',
            };

            let $update =$_POST;
           
            for(var kk in baoliu){
                if(typeof( $update[kk]) != "undefined"){
                    delete($update[kk]);
                }
            }

            if($data['superior0'] != '0'){
                delete($update['superior0']);
            }else{
                let $sanji = await Uid($update['superior0']);
                if($sanji){
                    for($i = 0; $i < SuperiorNum ;$i++){
                        if($i == 0){
                            $update['superior'+$i] = $sanji['id'] ;
                        }else{
                            let $zu = $i-1;
                            if(!isset($sanji['superior'+$zu ]) || $sanji['superior'+$zu ] < 1){
                                break ;
                            }
                            $update['superior'+$i] = $sanji['superior'+$zu];
                        }
                    }
                }

            }

            if(isset( $update['super'] ) &&  $update['super'] != ""){
                $update['super']  = Kuomm($update['super'] );
            }else{
                delete( $update['super'] );
            }


            let $fan = await $db.Where({id: $id}).Update($update);
            if($fan){
                await Uid($id,1);
                await Kuolog('adminlog',kuo.adminid,3,{'yuan':$data,'data':$update},kuo.func_,kuo.class,kuo.ip);
                $DATA.data = $update;
                $DATA.code =1;
                $DATA.msg = LANG.put_ok;
            }else{
                $DATA.code =-1;
                $DATA.msg = LANG.put_no;
            }
            
        }else if($kongzhi == 'add'){
    
           
            let baoliu = {
                'id':'id',
                'recharge':'recharge',
                'money':'money',
                'integral':'integral',
                'currency':'currency',
                'regip':'regip',
                'regtime':'regtime',
            };

            let $insert =$_POST;
           
            for(var kk in baoliu){
                if(typeof( $insert[kk]) != "undefined"){
                    delete($insert[kk]);
                }
            }

            if($insert['superior0']  > 0 ){
                let $sanji = await Uid($insert['superior0']);
                if($sanji){
                    for($i = 0; $i < SuperiorNum ;$i++){
                        if($i == 0){
                            $insert['superior'+$i] = $sanji['id'] ;
                        }else{
                            let $zu = $i-1;
                            if(!isset($sanji['superior'+$zu ]) || $sanji['superior'+$zu ] < 1){
                                break ;
                            }
                            $insert['superior'+$i] = $sanji['superior'+$zu];
                        }
                    }
                }
            }

            $insert['regip'] = kuo.ip;
            $insert['regtime'] = Mode("Tools").Time();
        
            if(isset( $insert['super'] ) &&  $insert['super'] != ""){
                $insert['super']  = Kuomm($insert['super'] );
            }
            $insert['security'] = Md5( Mode("Tools").Uuid() );

            let $fan =await $db.Insert($insert);
            if($fan){
                $DATA.code = 1;
                $DATA.msg = LANG.add_ok;
                await  Kuolog('adminlog',kuo.adminid,4, $insert ,kuo.func_,kuo.class,kuo.ip);
            
            }else{
                $DATA.code = -1;
                $DATA.msg = LANG.add_no;
            }
    
    
        }else if($kongzhi == 'del'){
    
            let $id = Mode("Tools").Int($_POST['id']?$_POST['id']:0);
            let $data = await $db.Where({id: $id}).Find();
    
            if(!$data){
                $DATA.code = -1;
                $DATA.msg = LANG.admin_id_no;
                Context.body = JSON.stringify($DATA);
                return ;
            }
    
            let $fan = await $db.Where({id: $id}).Delete();
            if($fan){
                await Uid($id,2);
                await  Kuolog('adminlog',kuo.adminid,5, $data ,kuo.func_,kuo.class,kuo.ip);
                $DATA.code = 1;
                $DATA.msg = LANG.del_ok;
            }else{
                $DATA.code = -1;
                $DATA.msg = LANG.del_no;
            }
    
    
        }
        
        Context.body = JSON.stringify($DATA);
    }
    
]